<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>Por mi empresa</title>

    <!-- Mobile viewport optimisation -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- (en) Add your meta data here -->
    <!-- (de) Fuegen Sie hier ihre Meta-Daten ein -->
    <link href="<?php echo $this->url;?>css/flexible-grids.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" media="screen" href="<?=$this->url;?>css/ui-lightness/jquery-ui-1.8.20.custom.css"/>
    <!--[if lte IE 7]>
    <?php echo $this->headLink()->appendStylesheet('./yaml/core/iehacks.css') ?>
    <![endif]-->

    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="<?php echo $this->url?>js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="<?=$this->url?>js/jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var currentUrl = $(location).attr('href');
            var layer = $(location).attr('href').match('(\\/[\\da-z].+\\/)([\\da-z]+)');
            if (layer == null) {
                layer = 'home';
            } else {
                layer = layer[2];
            }

            var text = $('#' + layer + ' a').text();
            $('#' + layer).addClass("active");
            //setUrl('<?=$this->url?>');

            $('#alerts div').hide();
            $('#alerts div').animate({height:'toggle'}, 1000).animate({opacity:1}, 4000).animate({height:'toggle'}, 1000);
        });

        function showStatus(success, msg) {
            var content;
            var idrandom = Math.floor(Math.random() * 1000);
            if (success) {
                content = "<div id=" + idrandom + " class='ui-state-highlight ui-corner-all' style='padding: 0 .7em;'>" +
                    "<p>" +
                    "<span class='ui-icon ui-icon-info' style='float: left; margin-right: .3em;'></span>" +
                    "<strong>Hey!</strong> " + msg + "</p>" +
                    "</div>";
            } else {
                content = "<div id=" + idrandom + " class='ui-state-error ui-corner-all' style='padding: 0 .7em;'>" +
                    "<p>" +
                    "<span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span>" +
                    "<strong>Error!</strong>" + msg + "</p>" +
                    "</div>";
            }
//    $('#alerts').html('');
            $('#alerts').append(content);
            $('#' + idrandom).hide();
            $('#' + idrandom).animate({height:'toggle'}, 1000).animate({opacity:1}, 4000).animate({height:'toggle'}, 1000);
        }
    </script>
    <style>
        h1 {
            font-size: 100%;
            font-weight: bold;
            text-transform: uppercase;
        }

        .ym-hlist ul li.active a {
            color: #AAAAAA;
            display: block;
            font-size: 1em;
            font-weight: bold;
            margin: 0;
        }
    </style>
</head>
<body>
<ul class="ym-skiplinks">
    <li><a class="ym-skip" href="#nav">Skip to navigation (Press Enter)</a></li>
    <li><a class="ym-skip" href="#main">Skip to main content (Press Enter)</a></li>
</ul>

<header>
    <div class="ym-wrapper">
        <div class="ym-wbox">
            <h1>
                <?=$this->security->getGranja() != null ? $this->security->getGranja()->getNombre() : 'Project Name' ?> </h1>
        </div>
    </div>
</header>
<nav id="nav">
    <div class="ym-wrapper">
        <div class="ym-hlist">
            <ul>
                <?if ($this->security->isSomeOne()): ?>
                <li id="home"><a
                    href="<?=$this->url(array('controller' => 'index', 'action' => 'index'), 'default', true) ?>">Home</a>
                </li>
                <? endif;?>

                <?if ($this->security->checkAction(SecurityController::ROL_FARM_CREATE)): ?>
                <li id="granjas"><a
                    href="<?=$this->url(array('controller' => 'granjas', 'action' => 'index'), 'default', true) ?>">Granjas</a>
                </li>
                <? endif;?>
                <?if ($this->security->isSomeOne() && $this->security->getGranja() != null): ?>
                <li id="hembras"><a
                    href="<?=$this->url(array('controller' => 'porcinos', 'action' => 'hembras'), 'default', true) ?>">Hembras</a>
                </li>
                <li><a href="#">Verracos</a></li>
                <li><a href="#">Engorde</a></li>
                <? endif;?>
                <? if ($this->security->checkAction(SecurityController::ROL_SHOW_USERS)): ?>
                <li><a href="<?=$this->url(array('controller' => 'usuarios', 'action' => 'index'), 'default', true) ?>">Usuarios</a>
                </li>
                <? endif; ?>
                <?if ($this->security->isSomeOne()): ?>
                <li><a href="<?=$this->url(array('controller' => 'login', 'action' => 'logout'), 'default', true) ?>">salir</a>
                </li>
                <? endif; ?>

            </ul>
<!--            <form class="ym-searchform">-->
<!--                <input class="ym-searchfield" type="search" placeholder="Search..."/>-->
<!--                <input class="ym-searchbutton" type="submit" value="Search"/>-->
<!--            </form>-->
        </div>
    </div>
</nav>
<div id="main">
    <div class="ym-wrapper">
        <div class="ym-wbox">
            <div id="alerts" class="ui-widget" style="position: absolute; width: 200px">
                <? if ($this->message != null): ?>
                <div class="ui-state-<?= $this->message['success'] ? 'highlight' : 'error'?> ui-corner-all"
                     style="">
                    <p style="vertical-align: middle;"><span
                        class="ui-icon ui-icon-<?= $this->message['success'] ? 'info' : 'alert'?>"
                        style="float: left; margin-right: .3em;"></span>
                        <?= $this->message['value']?></p>
                </div>
                <? endif;?>
            </div>
            <?= $this->layout()->content ?>
        </div>
    </div>
</div>
<footer>
    <div class="ym-wrapper">
        <div class="ym-wbox">
            <p>© Company 2012 &ndash; Layout based on <a href="http://www.yaml.de">YAML</a></p>
        </div>
    </div>
</footer>

<!-- full skip link functionality in webkit browsers -->
<script src="../yaml/core/js/yaml-focusfix.js"></script>
</body>
</html>